home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / utilities / gadoc.lha / gadoc.c / Docs / GAdoc.doc < prev    next >
Encoding:
Text File  |  1995-03-02  |  13.1 KB  |  422 lines

  1.  
  2.  
  3.  
  4.  
  5.                                  GAdoc
  6.  
  7.    A program to extract the autodocs from your source files.
  8.  
  9.    Get Autodoc generates a texinfo file, which can be converted into a
  10. .dvi file with TeX or into a hypertext using makeinfo.
  11.  
  12.    GAdoc was done by
  13.  
  14.          Gerhard Leibrock
  15.          Neuhäuselerstr. 12
  16.          D-66459 Kirkel
  17.          Germany
  18.      
  19.      
  20.          Tel.: 06849 / 6134
  21.          INTERNET: leibrock@fsinfo.cs.uni-sb.de
  22.                    fach5@cipsol.cs.uni-sb.de
  23.  
  24. Disclaimer
  25. **********
  26.  
  27.                             GAdoc, Feb 1995
  28.  
  29.    (C) 1995 by Gerhard Leibrock
  30.  
  31.    Although this piece of software was developped with greatest care,
  32. the author rejects any liability or responsibility for these or any
  33. other consequences from the use of `GAdoc' or whatsoever. This
  34. includes, but is not limited to, damage to your equipment, to your
  35. data, personal injuries, financial loss or any other kinds of side
  36. effects.
  37.  
  38.                              `NO warranty'
  39.  
  40.    There is no warranty for this software package. Although this piece
  41. of software was developped with greatest care, it is impossible to
  42. exclude the possibility of errors.You are therefore using this material
  43. at your `cvery own risk'. The author cannot be made responsible for any
  44. damage which is caused by using this software package.
  45.  
  46.    It is even possible, that this software will not run at all on your
  47. system.
  48.  
  49. Requirements
  50. ************
  51.  
  52.                          Amiga computer family
  53.  
  54.    The minimal configuration for running this program is at least 1MB
  55. of free RAM. If you got a compiled version of the program, you need at
  56. least OS 2.04, too, because it got compiled using gcc263 and this is an
  57. 2.x only compiler.
  58.  
  59.                                 Others
  60.  
  61.    To recompile GAdoc, you need an ANSI/C compiler, GNU/C works.  Just
  62. type in "make" (using gcc) and wait.
  63.  
  64.    If you want to use this program with MS-DOS, you have to alter the
  65. file extexsions, of the generated programs, otherwise the program might
  66. not work at all.
  67.  
  68.    Using this piece of software with U*IX computers caused no problem
  69. with SOLARIS and NetBSD. Use it at your own risk on other architectures.
  70.  
  71. Installation
  72. ************
  73.  
  74.    Just copy the executable to somewhere in your path.
  75.  
  76. What are autodocs?
  77. ******************
  78.  
  79.    Every programmer knows about the problems of software documentation
  80. or problems that arise from team work.
  81.  
  82.    After having finished a project or a part of it, you are glad that
  83. it works at all, but what about your partner or your boss? They also
  84. want to have the functions documented, if possible printed on paper.
  85.  
  86.    Now you have to sit down again and write down all that you kow about
  87. your functions. But what happens after you changed some parts of your
  88. functions, or added some ...? Your documentation will have to be
  89. rewritten.
  90.  
  91.    That's really a problem that also affects big firms, not only hobby
  92. programmers. There exist several systems, that allow you to write your
  93. program and documentation at the same time, like cweb does. cweb is
  94. great and very powerful, but most of the time, programmers need
  95. something more simple, this is the time that autodocs enter your life.
  96.  
  97.    Autodocs are easy to use within your source code, no matter which
  98. language you use, you only need a language, that allows you to use
  99. blocks of comments.
  100.  
  101. Starting a project
  102. ==================
  103.  
  104.    Every source file should start with an autodoc, that describes your
  105. project and gives GAdoc information about the author, the copyright
  106. holder etc.
  107.  
  108.    Here is an example:
  109.  
  110.      /****h* project/Intro ***************************************************
  111.      *
  112.      * NAME
  113.      *  project
  114.      *
  115.      * COPYRIGHT
  116.      *  No name software, inc.
  117.      *
  118.      * FUNCTION
  119.      *   This project is a project about projects.
  120.      *
  121.      * AUTHOR
  122.      *  Gerhard Leibrock
  123.      *
  124.      * VERSION
  125.      *  1.0
  126.      *
  127.      * NOTES
  128.      *  First project about how to make a project.
  129.      *
  130.      ****************************************************************************
  131.      */
  132.  
  133.    The first character gets ignored, then the line is checked for 4
  134. asterisks followed by "h*" and a space.
  135.  
  136.    After this "begin" keyword follows the name of the project, a slash
  137. ("/") and a short description (Could also be
  138. "project/TheNameOfTheGame").
  139.  
  140.    The keywords have the following meaning:
  141.  
  142. `NAME'
  143.      What's the name of your software?
  144.  
  145. `COPYRIGHT'
  146.      Who holds the copyright?
  147.  
  148. `FUNCTION'
  149.      What can be done with this program?
  150.  
  151. `AUTHOR'
  152.      Who wrote the software?
  153.  
  154. `VERSION'
  155.      Version number, remeber that the numbers should be read as real
  156.      decimals, meaning a Version number of 1.4 (one-point-4) refers to
  157.      an older release than a number of 1.11 (one-point-eleven).
  158.  
  159. `NOTES'
  160.      Bugs, features, statements, etc.
  161.  
  162.    Remember that this "header" must be specified before any other
  163. autodoc, otherwise, GAdoc will cease its operation and give you an
  164. error message.
  165.  
  166.    It is impossible not to specify the header. GAdoc will fill out the
  167. author's name with Unknown, the version number with 0.0 and other vague
  168. values.
  169.  
  170.    Also remember the order of the keywords, meaning NAME should be
  171. specified before NOTES, etc..
  172.  
  173. Function description
  174. ====================
  175.  
  176.    Here is an example of an autodoc for a function within C-source code:
  177.  
  178.      /****** misc/ShowReq ******************************************
  179.      *
  180.      * NAME
  181.      *  ShowReq -- Shows a requester (Needs at least KS 1.3)
  182.      *
  183.      * SYNOPSIS
  184.      *   void = ShowReq( Title, Text);
  185.      *                     D0   D0
  186.      *
  187.      *   void ShowReq ( STRPTR, STRPTR);
  188.      *
  189.      * FUNCTION
  190.      *   Display a requester with title and some text.
  191.      *
  192.      * INPUTS
  193.      *   Title  - Title of the requester
  194.      *   Text   - Message for the user
  195.      *
  196.      * RESULT
  197.      *   None
  198.      *
  199.      * EXAMPLE
  200.      *   ShowReq("J EDGAR HOOVER", "I regret to say that we of the FBI are\n"
  201.      *                                 "powerless to act in cases of oral-genital\n"
  202.      *                                 "intimacy, unless it has in some way\n"
  203.      *                                 "obstructed interstate commerce.");
  204.      *
  205.      *
  206.      * NOTES
  207.      *   Will not work on Amigas with Kickstart version < 1.3
  208.      *
  209.      * BUGS
  210.      *
  211.      *
  212.      * SEE ALSO
  213.      *   special/ShowTextAndPictureReq
  214.      *
  215.      ******************************************************************************/
  216.  
  217.    An autodoc for functions is recognized by the sequence of six
  218. asterisks ("******"), the first character gets ignored (Here the "/").
  219. Then follows a blank and the name of the module followed by "/" and the
  220. functions name. The rest of the line gets ignored.
  221.  
  222.    Here some valid examples:
  223.  
  224.      /****** module/name ------------------------------
  225.      ;****** module/name ------------------------------
  226.      ******* module/name ------------------------------
  227.  
  228.    This marks six asterisks as a special keyword, which should be used
  229. vers carefully.
  230.  
  231.    After this "begin" statement follows the description of the
  232. functions.  You can use some of the following keywords to describe it:
  233.  
  234. `NAME'
  235.      Put in the function's name, followed by two minus ("-") symbols and
  236.       a one line description. You should write sentences, ending with
  237.      a period   (".").
  238.  
  239. `SYNOPSIS'
  240.      It consists of three parts: The calling convention, the assembly
  241.      registers   and the function prototype. The line with the
  242.      prototype should be   "ready to compile". Take care of this (This
  243.      doesn't matter to GAdoc,   but "autodoc" as shipped with the 3.1
  244.      Amiga Developer Update, requires   this.
  245.  
  246. `FUNCTION'
  247.      Describe what your function does, try to avoid jargon and use
  248.      generally   accepted english. Write as much as needed but as short
  249.      as possible.
  250.  
  251. `INPUTS'
  252.      Describe the parameter's valid range and tell the reader what
  253.      happens,   it you receive e.g. a NULL-pointer or something like
  254.      that.    Use the variable name specified in the SYNOPSIS line and
  255.      use a minus   ("-") as a seperator (See example above).
  256.  
  257. `RESULT'
  258.      Describe the return values and error conditions, as error messages
  259.      ar   also seen as a kind of return value.
  260.  
  261. `EXAMPLE'
  262.      `Short' example of how to use your function. Test the example to
  263.      avoid   misunderstandings.
  264.  
  265. `NOTES'
  266.      Hints, warnings, tricks: Talk about side effects (If they exist),
  267.      etc.
  268.  
  269. `BUGS'
  270.      If your function has bugs, please describe them. Otherwise ignore
  271.      this.
  272.  
  273. `SEE ALSO'
  274.      If your function needs assistance of other functions, or you want
  275.      the   user to scan e.g. include files, list them here. GAdoc
  276.      recognizes references   to other modules ad generates a cross
  277.      link! But therefore, the name   before the "/" `must' be identical
  278.      to the file, where the function   is located.
  279.  
  280.    It is very important, that you use the keywords in the order listed
  281. above.  You might ignore some of them, so GAdoc will replace them with
  282. empty ones.
  283.  
  284.    An autodoc end with at least three asterisks at the start of a line
  285. ("***").
  286.  
  287.    Please do not use any tabs within your autodos since they are of no
  288. use with makeinfo or TeX.
  289.  
  290. Internal functions
  291. ==================
  292.  
  293.    If you do have functions, that should not be documented to others
  294. for any reason, you should mark them with "****i*" (four asterisks, "i",
  295. one asterisk). These functions will only be extracted if you specify the
  296. "-i" option with GAdoc.
  297.  
  298.    The syntax for internal functions is identical to that of normal
  299. functions.
  300.  
  301. How to use GAdoc
  302. ****************
  303.  
  304.    GAdoc can be used from any shell and accepts the following
  305. parameters:
  306.  
  307.    gadoc <source> <output> [-i -amiga -c]
  308.  
  309. `<source>:'
  310.      Name of the source files
  311.  
  312. `'
  313.      <output>:  Name of the generated files <output>.menu, <output>.data
  314.      (Existing files with identical names will be deleted without
  315.      warning!)
  316.  
  317. `-i'
  318.      Also extract internal autodocs
  319.  
  320. `-amiga'
  321.      Include amiga support for texinfo file
  322.  
  323. `-c'
  324.      Convert `\*' (Backslash asterisk) to `/*' and  ``\ *' to `*/'
  325.      (Important for C compilers, that do   not allow nested comments,
  326.      and this will happen, if you write down   c-comments within your
  327.      autodoc).
  328.  
  329.    The lines for the autodocs are limited to 80 chars/line.
  330.  
  331.    GAdoc reads the specified source file and generates two files with
  332. the extensions .menu and .data. The file with the .menu extension is
  333. considered to be the main part of the generated texinfo file.
  334.  
  335. The texinfo format
  336. ==================
  337.  
  338.    Texinfo is a documentation system that uses a single source file to
  339. produce both on-line information and printed output.
  340.  
  341.    To produce on-line information like plain ascii text or hypertext
  342. format, you need a program called makeinfo.
  343.  
  344.    It will generate a plain ascii file (Here: "output.doc"), if you
  345. invoke it like that:
  346.  
  347.      makeinfo --no-headers -o output.doc output.menu
  348.  
  349.    If you want to generate a gnu infoview file, you should invoke
  350. makeinfo with just the filename:
  351.  
  352.      makeinfo output.menu
  353.  
  354.    It will generate a file "output.guide", as this name is specified in
  355. output.menu.
  356.  
  357.    If you want to generate amiga specific files, use the "-amiga" flag,
  358. e.g.  to generate the amiga hypertext format for amigaguide:
  359.  
  360.      makeinfo --amiga output.menu
  361.  
  362.    To generate a .dvi file with TeX, just call virtex with the following
  363. parameters:
  364.  
  365.      virtex output.menu
  366.  
  367.    Make sure, you have the texinfo available to use it with virtex.
  368. (If you use a special amiga version, you need amigatexinfo also, but I
  369. never needed it at all.)
  370.  
  371. Error messages
  372. **************
  373.  
  374. ``-xy': Specified twice (See argument # `n')'
  375.      You specififed the parameter -xy twice.
  376.  
  377. `Unknown argument: <arg>'
  378.      The argument <arg> that you specified in the command line is
  379.      unknown   to GAdoc. Remeber that arguments with a mines ("-") are
  380.      only accepted   in lower case letters.
  381.  
  382. `Could not open file ``<fname>''.'
  383.      GAdoc could not open the requested file, maybe you should check its
  384.       spelling (Some OS distinguish between lower case and upper case
  385.      letters.)
  386.  
  387. `Error Line `n': Either keyword <key> used twice or in wrong order.'
  388.      Maybe you did specify a keyword more then one time in one function
  389.       description, or you used in wrong order.
  390.  
  391. `Error: End of file occured during internal docs.'
  392.      Maybe you forgot the three asterisks to end this internal
  393.      documentation.
  394.  
  395. `Error Line `n': Header specified after autodocs.'
  396.      As stated in this file, the header is to be specified before any
  397.      other   autodoc.
  398.  
  399. `Error Line `n': Second time header gets specified.'
  400.      You did specify two header sections.
  401.  
  402. `Error: End of file occured during internal block.'
  403.      During reading an autodoc for an internal function, an END OF FILE
  404.       signal occured, maybe you forgot to specify the end marker.
  405.  
  406. Index
  407. *****
  408.  
  409.  
  410.  
  411.  Disclaimer                             Disclaimer
  412.  Error messages                         Error messages
  413.  Function description                   Function description
  414.  How to use GAdoc                       How to use GAdoc
  415.  Installation                           Installation
  416.  Internal functions                     Internal functions
  417.  Requirements                           Requirements
  418.  Starting a project                     Starting a project
  419.  The texinfo format                     The texinfo format
  420.  What are autodocs?                     What are autodocs?
  421.  
  422.